cmake_minimum_required(VERSION 3.1.3)
include(cmakes/x86.cmake)
include(cmakes/comm.cmake)

project(facedetect)

if(USE_OPENMP)
    FIND_PACKAGE(OpenMP)
    if(OPENMP_FOUND)
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
        set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
    endif()
endif()

if(ENABLE_AVX2)
	add_definitions(-D_ENABLE_AVX2)
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2 -mfma")
endif()
if(ENABLE_AVX512)
	add_definitions(-D_ENABLE_AVX512)
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512bw")
endif()


include_directories(
	${CMAKE_SOURCE_DIR}/comm/
	${CMAKE_SOURCE_DIR}/comm/opensource	
	${CMAKE_SOURCE_DIR}/comm/platform/${PLATFORM}/opencv/include/opencv4
	${CMAKE_SOURCE_DIR}/src/libfacedetection
)
link_directories(
	${CMAKE_SOURCE_DIR}/comm/opensource/
	${CMAKE_SOURCE_DIR}/comm/platform/${PLATFORM}/lib
)

#build lib
add_subdirectory(src/)

if(DEMO)
add_subdirectory(example/)
endif()